import React from 'react'
import { useEffect, useState } from 'react'
import bcss from '../css/brand.module.css'
import { Link } from 'react-router-dom'

const Search = (props) => {
    // console.log(props.sdata);
    const [data, setdata] = useState([]);

    useEffect(() => {

       setdata(props.sdata);

    }, [])

    console.log(data, 111111);

    return (<div className={bcss.Box}>
        {data.map((el, index) => {
            return <div className={bcss.brand_box} key={index}>
                <div className={bcss.imgbox}></div>
                <Link to={{ pathname: '/Detail', state: { brandName: `${el.brandName}` } }}><img src={el.logo} alt="" className={bcss.brand_img} /></Link>
                <p className={bcss.brand_name}>{el.brandName}</p>
            </div>
        })}
    </div>
    )
}

export default Search